{extend name="base" /}
{block name="main"}
<div class="tpl-content-wrapper">
    <div class="tpl-content-page-title">
        回复询价
    </div>
    <ol class="am-breadcrumb">
        <li><a href="#" class="am-icon-home">首页</a></li>
        <li class="am-active">询价管理</li>
        <li class="am-active">回复</li>
    </ol>
    <div class="tpl-portlet-components">
        <div class="portlet-title">
            <div class="caption font-green bold">
                <span class="am-icon-code"></span> 表单
            </div>



        </div>
        <div class="tpl-block ">

            <div class="am-g tpl-amazeui-form">


                <div class="am-u-sm-12 am-u-md-9">
                    <form  action="/goods/Ask/update" method="post" class="am-form am-form-horizontal">
                        <div class="am-form-group">
                            <label for="user-name" class="am-u-sm-3 am-form-label"> ID </label>
                            <div class="am-u-sm-9">
                                <input type="text" name="id" value="{$data.id}" readonly>
                            </div>
                        </div>

                        <div class="am-form-group">
                            <label for="user-name" class="am-u-sm-3 am-form-label"> 用户ID </label>
                            <div class="am-u-sm-9">
                                <input type="text" name="uid" value="{$data.uid}" readonly>
                            </div>
                        </div>

                        <div class="am-form-group">
                            <label for="user-name" class="am-u-sm-3 am-form-label"> 股票名称 </label>
                            <div class="am-u-sm-9">
                                <input type="text" value="{$data.stockname}" readonly>
                            </div>
                        </div>

                        <div class="am-form-group">
                            <label for="user-name" class="am-u-sm-3 am-form-label"> 股票代码 </label>
                            <div class="am-u-sm-9">
                                <input type="text" value="{$data.stockcode}" readonly>
                            </div>
                        </div>

                        <div class="am-form-group">
                            <label for="user-name" class="am-u-sm-3 am-form-label"> 股票价格 </label>
                            <div class="am-u-sm-9">
                                <input type="text" value="{$data.stockprice}" readonly>
                            </div>
                        </div>

                        <div class="am-form-group">
                            <label for="user-name" class="am-u-sm-3 am-form-label"> 权利金 </label>
                            <div class="am-u-sm-9">
                                <input type="text" name="quanlijin" class="quanlijin" value="{$data.quanlijin}" readonly>
                            </div>
                        </div>

                        <div class="am-form-group">
                            <label for="user-name" class="am-u-sm-3 am-form-label"> 期权率(%) </label>
                            <div class="am-u-sm-9">
                                <input type="text" name="qiquanlv" class="qiquanlv" value="" {if $data.status==2}readonly{/if}>
                            </div>
                        </div>

                        <div class="am-form-group">
                            <label for="user-name" class="am-u-sm-3 am-form-label"> 交易周期 </label>
                            <div class="am-u-sm-9">
                                <input type="text" value="{$data.jyzq}" readonly>
                            </div>
                        </div>

                        <div class="am-form-group">
                            <label for="user-name" class="am-u-sm-3 am-form-label"> 名义本金 </label>
                            <div class="am-u-sm-9">
                                <input type="text" class="mybj" value="{$data.mybj}" readonly>
                            </div>
                        </div>

                        <div class="am-form-group">
                            <label for="user-name" class="am-u-sm-3 am-form-label"> 询价时间 </label>
                            <div class="am-u-sm-9">
                                <input type="text" value="{:date('y/m/d H:i:s',$data.xjtime)}" readonly>
                            </div>
                        </div>

                        <div class="am-form-group">
                            <label for="user-name" class="am-u-sm-3 am-form-label"> 答复时间 </label>
                            <div class="am-u-sm-9">
                                <input type="text" value="{if $data.status==1}未答复{else}{:date('y/m/d H:i:s',$data.dftime)}{/if}" readonly>
                            </div>
                        </div>

                        <div class="am-form-group">
                            <label for="user-name" class="am-u-sm-3 am-form-label"> 状态 </label>
                            <div class="am-u-sm-9">
                                <input type="text" value="{if $data.status==1}未答复{else}已答复{/if}" readonly>
                            </div>
                        </div>


                        <div class="am-form-group">
                            <div class="am-u-sm-9 am-u-sm-push-3">
                                <button type="submit" {if $data.status==2}disabled{/if} class="am-btn am-btn-primary">{if $data.status==1}答复{else}已答复{/if}</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>

    </div>

</div>

<script>
$(function(){
    $('.qiquanlv').on('input',function(){
        $(this).val($(this).val().replace(/[^\d\.]/g, '').replace(/\.{2}/g, '\.'));
        var qql = $(this);
        var mybj = $('.mybj').val();
        if(isNaN(qql.val())){
            alert('非法数值!');
            $('.qiquanlv').val('');
        }else{
            if(qql.val() !== '' && !qql.val().match(/\d\.$/)){
                qql.val( Math.round(qql.val()*100) /100 );
                $('.quanlijin').val(mybj * qql.val() / 100);
            }
            if(qql.val() < 0){
                alert('期权率不能为负');
                $('.qiquanlv').val('');
            }

            if(qql.val() > 100){
                alert('期权率不能超过100');
                $('.qiquanlv').val('');
            }

        }
    });



})



</script>



{/block}